/**
 *    @file       maintainudptask.h
 *
 *    @brief      
 *    @details
 *
 *    @version    1.0
 *    @date       02/17/2014 04:10:49 PM
 *
 *    @author     Theophilus (), wangtf418@gmail.com
 */
#ifndef _SF_MAINTAINUDPTASK_H_
#define _SF_MAINTAINUDPTASK_H_
#include "sockettask.h"


class maintainudptask : public sockettask
{
public:
	maintainudptask(csocket *sock, netprocessthread *netthread, const comargs *args = NULL);
	virtual ~maintainudptask();

public:
	virtual bf_int_t init(bf_time_t timeout = SOCKTASK_TIMEOUT, bf_int_t sock_buflen = 102400);
	virtual bf_int_t proc_msg(message *msg);
	virtual bf_int_t process_io_event(bf_int_t events);

protected:
	virtual bf_int_t recv_process();
	virtual bf_int_t send_process();
	virtual bf_int_t process_recv_packet(bf_char_t *buf, bf_size_t buflen);
	virtual bf_int_t put_send_packet(bf_char_t *buf, bf_size_t buflen);

protected:
	bf_char_t m_recvbuf[UDP_RECV_BUF_LEN];
	struct sockaddr_in m_addr;
};

#endif

